<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: install_step_2.php 136 2013-09-22 07:38:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 136 $
* 	zuletzt geaendert von:	$Author: peter $
* 	Datum:					$Date: 2013-09-22 07:38:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */
if(!defined('VALID_INSTALLER'))
	header('Location: ../../');

$db = ADONewConnection(DB_TYPE);
@$db->Connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE);

$db->Execute("SET NAMES 'utf8'");
$db->Execute("SET CHARACTER_SET_CLIENT = utf8");
$db->Execute("SET CHARACTER_SET_RESULTS = utf8");

$data_error = '';
$ready = false;

if (!empty($_GET['error'])) {
	$img_box = image(DIR_WS_ICONS.'/icons/cancel.gif');
	$class_box = 'red';
} else {
	$img_box = image(DIR_WS_ICONS.'/icons/tick.gif');
	$class_box = 'ok';
}

include('includes/metatag.php');
?>
<title>SEO:mercari Installation - Schritt 2</title>
<script type="text/javascript">
	function setButton() {
		$('#send_button').attr("disabled","disabled").css({opacity: 0.5});
		$('#send_form').submit();
	}
</script>
</head>
<body>
<?php include('includes/header.php'); ?>
<div id="wrapper">
	<div id="inner_wrapper">
		<table class="outerTable" width="100%" cellpadding="4">
			<tr>
				<td class="columnRight" valign="top">
					<table class="table_pageHeading" border="0" width="100%" cellspacing="0" cellpadding="0">
						<tr>
							<td class="pageHeading">
								<h1 class="schatten">Datenbank Installation</h1>
							</td>
						</tr>
					</table>
					<?php 
						
						if(file_exists(DIR_FS_CATALOG.'installer/sql/seo_mercari_pro.sql'))
							$parts = 14.3;
						else
							$parts = 16.67;
							
						switch($_GET['sql']) {
							case '1':
								$sql_do = 'Erstelle Grundstruktur - Teil 1 …';
								$percent = $parts*0;
								break;
							
							case '2':
								$sql_do = 'Erstelle Grundstruktur - Teil 2 …';
								$percent = $parts*1;
								break;
								
							case '3':
								$sql_do = 'Trage Demo- und Basisdaten ein …';
								$percent = $parts*2;
								break;
								
							case '4':
								$sql_do = 'Füge Länder ein …';
								$percent = $parts*3;
								break;
								
							case '5':
								$sql_do = 'Installiere Sprachvariablen …';
								$percent = $parts*4;
								break;
								
							case '6':
								$sql_do = 'Erstelle Emailvorlagen …';
								$percent = $parts*5;
								break;
								
							case '7':
								$sql_do = 'Installiere Zusatzdaten für die '.PROJECT_VERSION.PROJECT_VERSION_TYPE.' …';
								$percent = $parts*6;
								break;
						}
						
						echo '	<div style="text-align:center; font-size: 110%">
									'.$percent.'% - '.$sql_do.'</div>
									<div style="width: 90%; margin: 20px auto; background: none repeat scroll 0% 0% rgb(255, 255, 255); -webkit-box-shadow:0pt 2px 5px rgb(187, 187, 187); ;-moz-box-shadow:0pt 2px 5px rgb(187, 187, 187); box-shadow: 0pt 2px 5px rgb(187, 187, 187);">
								    <div style="display: block; background: rgb(172, 2, 2) url(images/ani.gif); width: '.$percent.'%;">&nbsp;</div>
								</div>';
					?>
				</td>
			</tr>
		</table>
	</div>
</div>
<?php
include('includes/footer.php');
flush();
?>
<script type="text/javascript">
<?php
switch($_GET['sql']) {
	case '1' :
		$ready = loadSQL(DIR_FS_CATALOG.'installer/sql/seo_mercari_community_create_1.sql');
		if($ready)
			echo 'window.location.href="index.php?step=2&sql=2"';
		break;
	
	case '2' :
		$ready = loadSQL(DIR_FS_CATALOG.'installer/sql/seo_mercari_community_create_2.sql');
		if($ready)
			echo 'window.location.href="index.php?step=2&sql=3"';
		break;
	
	case '3' :
		$ready = loadSQL(DIR_FS_CATALOG.'installer/sql/seo_mercari_community_insert.sql');
		if($ready)
			echo 'window.location.href="index.php?step=2&sql=4"';
		break;
	
	case '4' :
		$ready = loadSQL(DIR_FS_CATALOG.'installer/sql/seo_mercari_countries.sql');
		if($ready)
			echo 'window.location.href="index.php?step=2&sql=5"';
		break;
	
	case '5' :
		$ready = loadSQL(DIR_FS_CATALOG.'installer/sql/seo_mercari_language_german.sql');
		if($ready)	
			echo 'window.location.href="index.php?step=2&sql=6"';
		break;
	
	case '6' :
		$ready = loadSQL(DIR_FS_CATALOG.'installer/sql/seo_mercari_mails.sql');
		if(file_exists(DIR_FS_CATALOG.'installer/sql/seo_mercari_pro.sql')) {
			if($ready)
				echo 'window.location.href="index.php?step=2&sql=7"';
		} else
			echo 'window.location.href="index.php?step=3"';
		
		break;
	
	case '7' :
		if(file_exists(DIR_FS_CATALOG.'installer/sql/seo_mercari_pro.sql')) {
			$ready = loadSQL(DIR_FS_CATALOG.'installer/sql/seo_mercari_pro.sql');
			if($ready)
				echo 'window.location.href="index.php?step=3"';
		}
		break;
}
?>
</script>
</body>
</html>